'use strict';

define([
		'lib/angular/angular.min',
		'lib/angular/angular-resource.min',
		'lib/angular-ui-router/angular-ui-router.min'
	], function() {
		var angularModule = angular.module('twinsApp', ['ngResource', 'ui.router']);

		angularModule.config(function($stateProvider, $urlRouterProvider) {
			$stateProvider.state('home', {
				templateUrl : 'template/home.html',
				url : '/home',
				controller : 'homeController'
			});
			$stateProvider.state('family', {
				templateUrl : 'template/family.html',
				url : '/family',
				controller : 'familyController'
			});
			$stateProvider.state('giftList', {
				templateUrl : 'template/giftList.html',
				url : '/giftList',
				controller : 'giftListController',
				onEnter: function() {
					$('.scroll-pane').perfectScrollbar('update');
				}
			});
			$stateProvider.state('pictures', {
				templateUrl : 'template/pictures.html',
				url : '/pictures',
				controller : 'picturesController'
			});
			$stateProvider.state('twins', {
				templateUrl : 'template/twins.html',
				url : '/twins',
				controller : 'twinsController'
			});
			$urlRouterProvider.otherwise('/home');
		}).run(function($rootScope) {
			$rootScope.$on('$stateChangeSuccess', function() {
				$('.scroll-pane').perfectScrollbar('update');
			})
		});

		return angularModule;
});